#ifndef BLOCKSTORESTATEWIDGET_H
#define BLOCKSTORESTATEWIDGET_H

#include <QWidget>
#include <QTableView>
#include <QLabel>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include "BlockStoreModel.h"
#include "BlockStoreDelegate.h"
#include "CustomHeaderView.h"

class BlockStoreStateWidget : public QWidget
{
    Q_OBJECT

public:
    explicit BlockStoreStateWidget(QWidget *parent = nullptr);
    ~BlockStoreStateWidget();

    // 公共接口
    void setBlockStatus(int blockNumber, BlockStoreModel::BlockStatus status);
    BlockStoreModel::BlockStatus getBlockStatus(int blockNumber) const;
    void resetAllBlocks();
    int getTotalAvailableCount() const;

private slots:
    void updateTotalCount();

private:
    void setupUI();
    void setupTableView();

    QTableView *m_tableView;
    CustomHeaderView *m_customHeader;
    BlockStoreModel *m_model;
    BlockStoreDelegate *m_delegate;
    QLabel *m_totalCountLabel;
    QLabel *m_upperMoldLabel;
    QLabel *m_movableTypeLabel;
};

#endif // BLOCKSTORESTATEWIDGET_H